import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/values/MyColors.dart';
import 'package:flutter_app/widget/custom_app_bar.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';

import 'film_logic.dart';

/**
 * @Description: 随手拍上报记录
 * @Author: 下雨了
 * @CreateDate: 2022年5月31日 13:59:55
 * @Version: 1.0
 */
///
class FilmPage extends StatelessWidget {
  final String title;

  const FilmPage({
    Key? key,
    required this.title,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final logic = Get.put(FilmLogic());
    final state = Get.find<FilmLogic>().state;

    return Scaffold(
      backgroundColor: MyColors.FFF1F1F1,
      appBar: MyAppBar(context, title: "随手拍上报记录"),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // Container(
          //   width: Get.width,
          //   color: Colors.white,
          //   child: BrnTabBar(
          //     mode: BrnTabBarBadgeMode.average,
          //     tabWidth: 65.r,
          //     tabs: logic.badgeTab,
          //     controller: logic.tabController,
          //     indicatorWeight: 1.25.r,
          //     indicatorColor: MyColors.FFF7220C,
          //     backgroundcolor: Colors.white,
          //     padding: EdgeInsets.only(left: 4.r,),
          //     labelStyle: TextStyle(
          //         color: MyColors.FF333333,
          //         fontSize: 18.sp,
          //         fontWeight: FontWeight.w500),
          //     unselectedLabelStyle:
          //     TextStyle(color: MyColors.FF333333, fontSize: 14.sp),
          //   ),
          // ),
          Container(
            width: Get.width,
            height: 46.r,
            color: Colors.white,
            padding: EdgeInsets.only(left: 4.r),
            child: TabBar(
              tabs: [for (final tab in state.tabs) Tab(text: tab,)],
              // // 指示器
              indicatorColor: Colors.white,
              indicator: BoxDecoration(
                  borderRadius: BorderRadius.circular(2),
                  color: MyColors.FFF7220C),
              indicatorPadding: EdgeInsets.only(left: 20.r, right: 20.r, top: 40.r, bottom: 4.r),
              // 字体颜色
              labelColor: MyColors.FF333333,
              labelStyle: TextStyle(fontSize: 18.sp, fontWeight: FontWeight.w500),
              labelPadding: EdgeInsets.only(left: 9.5.r, right: 9.5.r),
              // 没有选中字体颜色
              unselectedLabelColor: MyColors.FF333333,
              unselectedLabelStyle: TextStyle(fontSize: 14.sp),
              // 是否滚动
              isScrollable: true,
              // 控制器
              controller: logic.tabController,
              physics: BouncingScrollPhysics(),
            ),
          ),
          Expanded(
            child: TabBarView(
              children: logic.widgets,
              controller: logic.tabController,
            ),
          ),
        ],
      ),
    );
  }
}
